import { Injectable } from '@angular/core';
import { HttpClient } from '../../../providers/httpClient';
import { Config } from '../../../providers/config';

@Injectable()
export class AuthorizationListService {
	constructor(
		public httpClient: HttpClient,
		public config: Config
	) { }

	getListData(params) {
		let postBody = {
			"module": "OAServer",
			"method": "getAuthorizationList",
			"params": {
				"loginid": "",
				"needRenewAPI": params.needRenewAPI,
				"needSearch": params.needSearch,
				"name": params.nameCondition,
				"isHis": params.isHis,
				"page": params.page,
				"pageSize": this.config.pageSize
			}
		}
		console.log(postBody);
		return this.httpClient.post(postBody);
	}

	/**
	 * [deleteAuthorization 删除授权]
	 * @param {[type]} numb [description]
	 */
	deleteAuthorization(numb) {
		let postBody = {
			"module": "WorkFlow",
			"method": "deleteAuthorization",
			"params": {
				"loginId": "",
				"numb": numb
			}
		};
		return this.httpClient.post(postBody, {
			isShowLoading: true
		});
	}
}